﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

namespace BeniBastanYaratProject.Yonetim
{
    public partial class MarkaIslemleri : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }



        protected void Button1_Click(object sender, EventArgs e)
        {
DBBaglantiDataContext db = new DBBaglantiDataContext();
            

            Markalar yeniMarka = new Markalar();
            yeniMarka.MarkaFirmaAdi = txtFirmaAdi.Text;
            yeniMarka.MarkaFirmaAdresi = txtFirmaAdresi.Text;
            yeniMarka.MarkaFirmaEposta = txtFirmaEposta.Text;
            yeniMarka.MarkaFirmaFax = txtFirmaFax.Text;
            yeniMarka.MarkaFirmaNot = txtFirmaNot.Text;
            yeniMarka.MarkaFirmaTelefon01 = txtFirmaTel.Text;
            yeniMarka.MarkaFirmaTelefon02 = txtFirmaTel2.Text;
            yeniMarka.MarkaFirmaTelefon03 = txtFirmaTel3.Text;
            yeniMarka.MarkaFirmaYetkili = txtFirmaYetkili.Text;
            db.Markalars.InsertOnSubmit(yeniMarka);
            db.SubmitChanges();
            Response.Write("Yeni Marka Kaydedilmiştir");
            txtFirmaAdi.Text = "";
            txtFirmaAdresi.Text = "";
            txtFirmaEposta.Text = "";
            txtFirmaFax.Text = "";
            txtFirmaNot.Text = "";
            txtFirmaTel.Text = "";
            txtFirmaTel2.Text = "";
            txtFirmaTel3.Text = "";
            txtFirmaYetkili.Text = "";



        }
        protected void ImageButton1_Click(object sender, EventArgs e)
        {
            DBBaglantiDataContext db = new DBBaglantiDataContext();
            int markaid = int.Parse(ViewState["markaid"].ToString());
            var Sorgu = (from x in db.Markalars where x.MarkaID == markaid select x ).FirstOrDefault();
          
            Response.Redirect("MarkaIslemleri.aspx");
        }




    }
}